public class Solution {
    public int ans;

    public int subsetXORSum(int[] nums) {
        dfs(nums,0,0);
        return ans;
    }

    private void dfs(int[] nums, int pos,int sum) {
        if(pos== nums.length){
            ans+=sum;
            return ;
        }
        //不选这个数
        dfs(nums,pos+1,sum);
        //选这个数
        sum=sum^ nums[pos];
        dfs(nums,pos+1,sum);
    }
}
